package main
import (
	"fmt"
	"io/ioutil"
	"flag"
	"github.com/gobuffalo/packr"
)


//  35. 读取文件
func main(){
	data, err := ioutil.ReadFile("G:/yanghao/code/go_code/go_study/goproject/src/studygolang/35/test.txt")
	if err != nil {
		fmt.Println("File reading error", err)
		return
	}
	fmt.Println("Contents if file:\n", string(data))
	fmt.Println(data)

	fmt.Println("=========== 使用命令行标记来传递文件路径 ================")
	fptr := flag.String("fpath", "test.txt", "file path to read from")
	flag.Parse()
	fmt.Println("value of fpath is", *fptr)
	fmt.Println("value of fpath is", fptr)

	fmt.Println("=========== 将文件绑定在二进制文件中s ================")
	box := packr.NewBox("../filehandling")
    data := box.String("test.txt")
    fmt.Println("Contents of file:", data)



}
